<?php
/**
 * Created by PhpStorm.
 * User: Hanson
 * Date: 2016/9/12
 * Time: 0:57
 */

namespace App\Handlers\Middleware;


use App\Model\NetworkInfo;

class Password implements MiddlewareInterface
{

    public static function fire($message, $keyword = null)
    {
        if($keyword){
            return '回复“开网密码”查询H3C客户端密码';
        }

        $network = NetworkInfo::where('open_id', $message->FromUserName)->where('password', '!=', '')->first();

        return $network && $network->password ? '你的开网密码为“' . $network->password . '”' : '你并没有在此预注册或没有设置保存密码';
    }

}